package com.market.web.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;

import org.primefaces.model.StreamedContent;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.market.domain.Picture;

@Component("pictureModel")
@Scope("session")
public class PictureModel extends GenericModel<Picture> {

	private String galleryYear = "2013";
	


	public String getGalleryYear() {
		return galleryYear;
	}

	public void setGalleryYear(String galleryYear) {
		this.galleryYear = galleryYear;
	}
	
	private Picture.TYPE galleryPictureType = Picture.TYPE.FARM;

	public Picture.TYPE getGalleryPictureType() {
		return galleryPictureType;
	}

	public void setGalleryPictureType(Picture.TYPE galleryPictureType) {
		this.galleryPictureType = galleryPictureType;
	}

	private List<Picture> homePagePictures;

	public List<SelectItem> getAvailableTypes() {
		List<SelectItem> types = new ArrayList<SelectItem>();
		for (Picture.TYPE type : Picture.TYPE.values()) {
			types.add(new SelectItem(type, type.getLabel()));
		}
		return types;
	}

	public List<Picture> getHomePagePictures() {
		return homePagePictures;
	}

	public void setHomePagePictures(List<Picture> homePagePictures) {
		this.homePagePictures = homePagePictures;
	}

	@Override
	public Picture getNewObject() {
		Picture pic = new Picture();
		pic.setIsNew(true);
		return pic;
	}

}
